package config;

import utils.FileHeaderCheckInterceptor;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

//@Configuration
public class MyfWebAppConfiguration extends WebMvcConfigurerAdapter {
	
    //拦截器，拦截文件流
	@Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new FileHeaderCheckInterceptor())
                .addPathPatterns("/**"); 
    }
	
//	//注册过滤
//	@Bean
//	public FilterRegistrationBean myFilterRegistration() {
//	 
//	   FilterRegistrationBean registration = new FilterRegistrationBean();
//	   registration.setFilter(new LoginFilter());
//	   registration.addUrlPatterns("/serviceInvoke");
//	   //registration.addInitParameter("paramName", "paramValue");
//	   registration.setName("loginFilter");
//	   registration.setOrder(1);
//	   return registration;
//	 }
//	
//	
//	//注册servlet
//	@Bean  
//    public ServletRegistrationBean myServletRegistration() {  
//        ServletRegistrationBean registration = new ServletRegistrationBean(new DownloadServlet());  
//        registration.addUrlMappings("/download");  
//        return registration;  
//    } 
}